
// react
import React from "react";
// lib
import { Space, Button, Popconfirm } from "antd";
// store
import { state } from "./state";
import { delRoom } from "./controller";
// controller
// import { delAdmin } from "./controller";

const TableColumns = [
  {
    title: "房间ID",
    dataIndex: "roomId",
  },
  {
    title: "房间名称",
    dataIndex: "roomName",
  },

  {
    title: "房间位置",
    dataIndex: "roomLocation",
  },
  {
    title: "操作",
    key: "action",
    fixed: "right" as any,
    render: (el: RoomDto) => {
      const edit = () => {
        state.editModal = el;
      };

      const del = () => {
        delRoom(el.roomId);
      };

      return (
        <Space>
          <Button size="small" type="primary" ghost onClick={edit}>
            编辑
          </Button>

          <Popconfirm title={"确定要删除吗？"} onConfirm={del}>
            <Button size="small" danger ghost>
              删除
            </Button>
          </Popconfirm>
        </Space>
      );
    },
  },
];

export default TableColumns;
